package com.sgu6.redis.container;

import com.sgu6.redis.cache.GoodsCache;
import com.sgu6.redis.cache.MachineCache;
import com.sgu6.redis.dto.GoodsSimpleDto;


import java.util.List;
import java.util.Map;


public class GoodsContainer {

    public  static List<String> GOODS_LIST ;
    public  static Map<String, GoodsSimpleDto> GOOD_INFO;

    private static void getGoodsList(String ip,String machineNo){
        try {
            GOODS_LIST = MachineCache.getMachineGoods(ip,machineNo);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static  Map<String, GoodsSimpleDto> getGoodsInfo(String ip,String machineNo)  {
        getGoodsList(ip,machineNo);
        return GoodsCache.getGoodsInfoMap(ip,GOODS_LIST);
    }
}
